//
//  CashTabbarController.m
//  CashBook
//
//  Created by 吴斌 on 2024/9/3.
//

#import "CashTabbarController.h"
#import "CashHomeViewController.h"
#import "CashQushiController.h"
#import "CashMeController.h"

@interface CashTabbarController ()

@end

@implementation CashTabbarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self makeSubTabbar:@"记账" withImgName:@"cash" withCtrl:[[CashHomeViewController alloc] init]];
    [self makeSubTabbar:@"趋势" withImgName:@"trend" withCtrl:[[CashQushiController alloc] init]];
    [self makeSubTabbar:@"我的" withImgName:@"me" withCtrl:[[CashMeController alloc] init]];
}
- (void)makeSubTabbar:(NSString *)title withImgName:(NSString *)imageName withCtrl:(UIViewController *)ctrl{
    NSString * norImg = [NSString stringWithFormat:@"%@_Nor",imageName];
    NSString * setImg = [NSString stringWithFormat:@"%@_Set",imageName];
    UINavigationController * navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
    ctrl.navigationController.navigationBar.barTintColor = UIColor.whiteColor;
    ctrl.tabBarItem.title = title;
    ctrl.tabBarItem.image = [[UIImage imageNamed:norImg] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    ctrl.tabBarItem.selectedImage = [[UIImage imageNamed:setImg] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [self addChildViewController:navCtrl];
}
@end
